package com.h3c.ptability.client;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "eos-data",url = "${eos.token.url}")
public interface EosSyncDataClient {

    /**
     * 获取eos汇率
     * @param Authorization
     * @return
     */
    @PostMapping(value = "/orgbaseinfo/v1.0/views/hrssc_finance_rate", consumes = {"application/json"}, headers = {"Authorization=Bearer {Authorization}"})
    JSONObject syncExchangeRate(@RequestParam("Authorization") String Authorization);

    /**
     * 获取eostoken
     * @param data
     * @return
     */
    @PostMapping(value = "/user/v1.0/account/token", consumes = {"application/json"})
    JSONObject getEosToken(@RequestBody String data);


    /**
     * 获取及安全中心token
     * @param data
     * @return
     */
    @PostMapping(value = "/auth/v1.0/api/user/login", consumes = {"application/json"},headers = {"Auth-Type=DB","Eos-Project=${eosProjectId}"})
    JSONObject getAuthenticationCenterToken(@RequestBody String data);

    /**
     * 同步公司所有部门信息
     * http://api.eos-ts.h3c.com/orgbaseinfo/v1.0/views/hrssc_depts
     * dept_code -> 50030459
     * deptAbbreviation -> null
     * sup_dept_code -> 50041665
     * dept_name -> Comware开发部IP业务开发部
     * dept_code_chain -> 50040000/50040426/50041665/50030459
     * dept_level -> 3
     * dept_name_chain -> 新华三/研究开发部外协/Comware开发部/Comware开发部IP业务开发部
    */
    @PostMapping(value = "orgbaseinfo/v1.0/views/hrssc_depts ", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject queryAllDept(@RequestParam("Authorization") String Authorization) ;

    /**
     * 同步员工
     * @param Authorization
     * @return
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/inventory_emps", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String syncAllWorker(@RequestParam("Authorization") String Authorization) ;

    /**
     * 同步新员工
     * @param Authorization
     * @return
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/nem_emps", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String syncNewWorker(@RequestParam("Authorization") String Authorization,@RequestBody String data) ;

    /**
     * 查询员工信息
     * @param Authorization
     * @return
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/inventory_emp_label", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String getWorkerInfo(@RequestParam("Authorization") String Authorization,@RequestBody String data) ;

    /**
     * 同步预备员工
     * @param Authorization
     * @return
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/nem_waitingentry", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    String syncPreWorker(@RequestParam("Authorization") String Authorization,@RequestBody String data) ;

    /**
     * 获取日历
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/public_calendar", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject getPublicCalendar(@RequestParam("Authorization") String Authorization);

    /**
     * 同步公司所有部门主管信息
     *http://api.eos.h3c.com/orgbaseinfo/v1.0/views/performance_manager_all
     * @param Authorization
     * @return
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/performance_manager_all ", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject queryDeptManage(@RequestParam("Authorization") String Authorization) ;

    /**
     * 同步全部主管数据
     * @param Authorization 令牌
     * @return 全部主管数据
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/getAllManager", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject getAllManager(@RequestParam("Authorization") String Authorization) ;

    /**
     * 获取特殊部门集合
     * @param Authorization 令牌
     * @return 特殊部门集合
     */
    @PostMapping(value = "orgbaseinfo/v1.0/views/getSpecialDeptCodes", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject getSpecialDeptCodesFromEos(@RequestParam("Authorization") String Authorization) ;

}
